// Token 相关 ABI
export const tokenAbi = [
  'function name() external view returns (string)',
  'function symbol() external view returns (string)',
  'function decimals() external view returns (uint8)',
  'function owner() external view returns (address)',
  'function totalSupply() external view returns (uint256)',
  'function balanceOf(address account) external view returns (uint256)',
  'function transfer(address recipient, uint256 amount) public returns (bool)',
  'function approve(address spender, uint256 amount) external returns (bool)',
  'event Transfer(address indexed from, address indexed to, uint256 value)',
  'function allowance(address tokenOwner,address spender) external view returns (uint256)',
  'function transferFrom(address sender,address recipient,uint256 amount) public returns (bool)'
]

// 空投相关 ABI
export const airdropAbi = [
  'function multiTransferToken(address _token,address[] calldata _addresses,uint256[] calldata _amounts) external',
  'function multiTranserETH(address[] calldata _addresses,uint256[] calldata _amounts) external payable',
  'function transfer(address _token, address recipient, uint256 mount) public',
  'function getBalance(address _token) public view returns (uint256)',
  'function allowance(address _token,address spender) public view returns (uint256)',
  'function getTmount() public view returns (uint256)'
]

// ETH 发送相关 ABI
export const sendEthAbi = [
  'function sendEth(address payable _to, uint256 amount) external payable',
  'function getBalance() public view returns (uint)',
  'event Log(uint amount, uint gas)'
]

// 投票相关 ABI
export const votingAbi = [
  'function addCandidate(string memory _name) public',
  'function vote(uint256 _candidateIndex) public',
  'function getAllVotesOfCandiates() public view returns (tuple(string name, uint256 voteCount)[])',
  'function getVotingStatus() public view returns (bool)',
  'function getRemainingTime() public view returns (uint256)',
  'function voters(address) public view returns (bool)',
  'function owner() public view returns (address)'
]

// Token ABI
const TOKEN_ABI = [
  "function balanceOf(address owner) view returns (uint256)",
  "function decimals() view returns (uint8)",
  "function symbol() view returns (string)",
  "function transfer(address to, uint amount) returns (bool)",
  "event Transfer(address indexed from, address indexed to, uint amount)"
]

// Airdrop ABI
const AIRDROP_ABI = [
  "function claim() external",
  "function hasClaimed(address) external view returns (bool)",
  "function owner() external view returns (address)"
]

// Voting ABI
const VOTING_ABI = [
  "function vote(uint256 candidateIndex) external",
  "function hasVoted(address voter) external view returns (bool)",
  "function getCandidates() external view returns (string[] memory)",
  "function getVotes(uint256 candidateIndex) external view returns (uint256)"
]


// IPFS存储合约 ABI
export const IPFSHashStorageABI = [
  {
    "inputs": [
      {
        "internalType": "string",
        "name": "fileName",
        "type": "string"
      },
      {
        "internalType": "string",
        "name": "ipfsHash",
        "type": "string"
      }
    ],
    "name": "upload",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "string",
        "name": "fileName",
        "type": "string"
      }
    ],
    "name": "getIPFSHash",
    "outputs": [
      {
        "internalType": "string",
        "name": "",
        "type": "string"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "string",
        "name": "fileName",
        "type": "string"
      }
    ],
    "name": "isFileStored",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  }
]


// Export all ABIs
export const ABIS = {
  TOKEN: TOKEN_ABI,
  AIRDROP: AIRDROP_ABI,
  VOTING: VOTING_ABI,
  IPFS: IPFSHashStorageABI
}
